home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / gfx / pbm / hpcd2ppm_0_5_pl1.lha / hpcdtoppm.0.5.pl1 / src / error.c < prev    next >
C/C++ Source or Header  |  1993-08-20  |  9KB  |  123 lines

  1. /* hpcdtoppm (Hadmut's pcdtoppm) v0.5pl1
  2. *  Copyright (c) 1992, 1993 by Hadmut Danisch (danisch@ira.uka.de).
  3. *  Permission to use and distribute this software and its
  4. *  documentation for noncommercial use and without fee is hereby granted,
  5. *  provided that the above copyright notice appear in all copies and that
  6. *  both that copyright notice and this permission notice appear in
  7. *  supporting documentation. It is not allowed to sell this software in 
  8. *  any way. This software is not public domain.
  9. */
  10.  
  11. #include "hpcdtoppm.h"
  12. #define X(a,b) ((a == b) ? "->" : "  ")
  13.  
  14. void eerror(enum ERRORS e,char *file,int line)
  15.  {
  16.   
  17.   switch(e)
  18.    {case E_NONE:   return;
  19.     case E_IMP:    fprintf(stderr,"Sorry, Not yet implemented. [%s:%d]\n",file,line); break;
  20.     case E_READ:   fprintf(stderr,"Error while reading.\n"); break;
  21.     case E_WRITE:  fprintf(stderr,"Error while writing.\n"); break;
  22.     case E_INTERN: fprintf(stderr,"Internal error. [%s:%d]\n",file,line); break;
  23.     case E_ARG:    fprintf(stderr,"Error in Arguments !\n\n"); 
  24. #ifdef SHORT_HELP
  25.                    fprintf(stderr,"Usage: hpcdtoppm [options] pcd-file [ppm-file]\n");
  26.                    fprintf(stderr,"       ( - means stdin )\n");
  27.                    fprintf(stderr,"Opts:         [ -> = Default ] \n\n");
  28.                    fprintf(stderr,"   [-x] [-s] [-d] [-i] [-m]\n");
  29.                    fprintf(stderr,"   [-crop] [-pos] [-rep] [-vert] [-hori] [-S h v]\n");
  30.                    fprintf(stderr,"   [-n] [-r] [-l] [-h] [-a]\n");
  31.                    fprintf(stderr,"   [-ppm] [-pgm] [-ycc] [-ps] [-eps] [-psg] [-epsg] [-psd] [-epsd]\n");
  32.                    fprintf(stderr,"   [-pl f] [-pb f] [-pw f] [-ph f] [-dpi f] [-fak f]\n");
  33.                    fprintf(stderr,"   [-c0] [-c-] [-c+]\n");
  34.                    fprintf(stderr,"   [-0] [-C d s] [-1] [-2] [-3] [-4] [-5]\n");
  35.  
  36. #endif
  37. #ifdef LONG_HELP
  38.                    fprintf(stderr,"Usage: hpcdtoppm [options] pcd-file [ppm-file]\n");
  39.                    fprintf(stderr,"       ( - means stdin )\n");
  40.                    fprintf(stderr,"Opts:         [ -> = Default ] \n\n");
  41.  
  42.                    fprintf(stderr,"     -x     Overskip mode (tries to improve color quality.)\n");
  43.                    fprintf(stderr,"     -s     Apply simple sharpness-operator on the Luma-channel.\n");
  44.                    fprintf(stderr,"     -d     Show differential picture only.\n");
  45.                    fprintf(stderr,"     -i     Give some (buggy) informations from fileheader.\n");
  46.                    fprintf(stderr,"     -m     Show the decoding steps to stderr.\n");
  47.                    fprintf(stderr,"     -crop  Try to cut off the black frame.\n");
  48.                    fprintf(stderr,"     -pos   Print file position of image to stderr.\n");
  49.                    fprintf(stderr,"     -rep   Try to jump over defects in the Huffman Code.\n");
  50.                    fprintf(stderr,"     -vert  Flip image vert.\n");
  51.                    fprintf(stderr,"     -hori  Flip image horiz.\n");
  52.                    fprintf(stderr,"     -S h v Decode subrectangle with hori. and vert. boundaries h,v,\n");
  53.                    fprintf(stderr,"            h,v of the form a-b or a+b, a and b integer or float [0.0...1.0]\n");
  54.                    fprintf(stderr,"\n");
  55.  
  56.                    fprintf(stderr," %s  -n     Don't rotate.\n",                                 X(T_DEFAULT,T_NONE));
  57.                    fprintf(stderr," %s  -r     Rotate clockwise for portraits.\n" ,              X(T_DEFAULT,T_RIGHT));
  58.                    fprintf(stderr," %s  -l     Rotate counter-clockwise for portraits.\n",       X(T_DEFAULT,T_LEFT));
  59.                    fprintf(stderr," %s  -h     Rotate twice, turn on head.\n",                   X(T_DEFAULT,T_HEAD));
  60.                    fprintf(stderr," %s  -a     Try to find out orientation automatically.\n",    X(T_DEFAULT,T_AUTO));
  61.                    fprintf(stderr,"\n");
  62.  
  63.                    fprintf(stderr," %s  -ppm   output rgb  (ppm-format). \n",                    X(O_DEFAULT,O_PPM));
  64.                    fprintf(stderr," %s  -pgm   output gray (pgm-format). \n",                    X(O_DEFAULT,O_PGM));
  65.                    fprintf(stderr," %s  -ycc   output ycc  (ppm-format). \n",                    X(O_DEFAULT,O_YCC));
  66.                    fprintf(stderr," %s  -ps    output postscript (rgb). \n",                     X(O_DEFAULT,O_PS));
  67.                    fprintf(stderr," %s  -eps   output encapsulated postscript (rgb). \n",        X(O_DEFAULT,O_EPS));
  68.                    fprintf(stderr," %s  -psg   output postscript (grayscale). \n",               X(O_DEFAULT,O_PSG));
  69.                    fprintf(stderr," %s  -epsg  output encapsulated postscript (grayscale). \n",  X(O_DEFAULT,O_EPSG));
  70.                    fprintf(stderr," %s  -psd   output postscript (b&w dithered). \n",            X(O_DEFAULT,O_PSG));
  71.                    fprintf(stderr," %s  -epsd  output encapsulated postscript (b&w dithered).\n",X(O_DEFAULT,O_EPSG));
  72.                    fprintf(stderr,"     -pl  f Postscript paper left position    [ Def:  %8.3f ]\n",DEF_PAPER_LEFT);
  73.                    fprintf(stderr,"     -pb  f Postscript paper bottom position  [ Def:  %8.3f ]\n",DEF_PAPER_BOTTOM);
  74.                    fprintf(stderr,"     -pw  f Postscript paper width            [ Def:  %8.3f ]\n",DEF_PAPER_WIDTH);
  75.                    fprintf(stderr,"     -ph  f Postscript paper height           [ Def:  %8.3f ]\n",DEF_PAPER_HEIGHT);
  76.                    fprintf(stderr,"     -dpi f Postscript resolution for dith.   [ Def:  %8.3f ]\n",DEF_DPI);
  77.                    fprintf(stderr,"     -fak f Scaling factor for dith.          [ Def:     1.0   ]\n");
  78.                    fprintf(stderr,"\n");
  79.  
  80.                    fprintf(stderr," %s  -c0    don't correct (linear).\n", X(C_DEFAULT,C_LINEAR));
  81.                    fprintf(stderr," %s  -c-    correct darker.\n",         X(C_DEFAULT,C_DARK));
  82.                    fprintf(stderr," %s  -c+    correct brighter.\n",       X(C_DEFAULT,C_BRIGHT));
  83.                    fprintf(stderr,"\n");
  84.  
  85.                    fprintf(stderr," %s  -0     Extract thumbnails from Overview file.\n",        X(S_DEFAULT,S_Over));
  86.                    fprintf(stderr," %s  -C d s Extract contact sheet from Overview file, d images width,\n",X(S_DEFAULT,S_Contact)); 
  87.                    fprintf(stderr,"            with contact sheet orientation s ( one of n l r h).\n");
  88.                    fprintf(stderr," %s  -1     Extract  128x192   from Image file.\n",           X(S_DEFAULT,S_Base16));
  89.                    fprintf(stderr," %s  -2     Extract  256x384   from Image file.\n",           X(S_DEFAULT,S_Base4));
  90.                    fprintf(stderr," %s  -3     Extract  512x768   from Image file.\n",           X(S_DEFAULT,S_Base));
  91.                    fprintf(stderr," %s  -4     Extract 1024x1536  from Image file.\n",           X(S_DEFAULT,S_4Base));
  92.                    fprintf(stderr," %s  -5     Extract 2048x3072  from Image file.\n",           X(S_DEFAULT,S_16Base));
  93.                    fprintf(stderr,"\n");
  94. #endif
  95.                    break;
  96.     case E_OPT:    fprintf(stderr,"These Options are not allowed together.\n");break;
  97.     case E_MEM:    fprintf(stderr,"Not enough memory !\n"); break;
  98.     case E_HUFF:   fprintf(stderr,"Error in Huffman-Code-Table\n"); break;
  99.     case E_SEQ:    fprintf(stderr,"Error in Huffman-Sequence, try option -rep\n"); break;
  100.     case E_SEQ1:   fprintf(stderr,"Error1 in Huffman-Sequence, try option -rep\n"); break;
  101.     case E_SEQ2:   fprintf(stderr,"Error2 in Huffman-Sequence, try option -rep\n"); break;
  102.     case E_SEQ3:   fprintf(stderr,"Error3 in Huffman-Sequence, try option -rep\n"); break;
  103.     case E_SEQ4:   fprintf(stderr,"Error4 in Huffman-Sequence, try option -rep\n"); break;
  104.     case E_SEQ5:   fprintf(stderr,"Error5 in Huffman-Sequence, try option -rep\n"); break;
  105.     case E_SEQ6:   fprintf(stderr,"Error6 in Huffman-Sequence, try option -rep\n"); break;
  106.     case E_SEQ7:   fprintf(stderr,"Error7 in Huffman-Sequence, try option -rep\n"); break;
  107.     case E_POS:    fprintf(stderr,"Error in file-position\n"); break;
  108.     case E_OVSKIP: fprintf(stderr,"Can't read this resolution in overskip-mode\n"); break;
  109.     case E_TAUTO:  fprintf(stderr,"Can't determine the orientation in overview mode\n");break;
  110.     case E_SUBR:   fprintf(stderr,"Error in Subrectangle Parameters\n");break;
  111.     case E_PRPAR:  fprintf(stderr,"Bad printing parameters\n");break;
  112.     case E_CONFIG: fprintf(stderr,"Something is wrong with your configuration [see %s:%d]\n",file,line);
  113.                    fprintf(stderr,"Edit the config.h and recompile...\n"); break;
  114.     case E_TCANT:  fprintf(stderr,"Sorry, can't determine orientation for this file.\n");
  115.                    fprintf(stderr,"Please give orientation parameters. \n");break;
  116.     default:       fprintf(stderr,"Unknown error %d ???  [%s:%d]\n",e,file,line);break;
  117.    }
  118.   close_all();
  119.   exit(9);
  120.  }
  121.  
  122.  
  123.